package com.elh.nio.test3;

import java.io.*;
import java.net.Socket;

/**
 * @author liulei
 **/
public class Client {

    public static void main(String[] args) throws Exception {
        String pngFile = "c:\\11.png";
        FileInputStream png = new FileInputStream(new File(pngFile));
        byte[] bytes = new byte[2048];
        Socket socket = new Socket("localhost",8088);
        OutputStream outputStream = socket.getOutputStream();
        int t = 0;
        while((t = png.read(bytes)) != -1){
            outputStream.write(bytes,0,t);
        }
        outputStream.close();
        socket.close();
        png.close();
    }

}
